<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>用户主页</title>
       <link rel="shortcut icon" href="{{ static('images/logo.ico') }}"/>
    <meta name="keywords" content="小宅社区">
    <meta name="description" content="小宅社区">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href={{ static('js/layui/css/layui.css') }}>
    {#  <link rel="stylesheet" href="../res/css/global.css">#}
    <link rel="stylesheet" href={{ static('css/global.css') }}>
    <script src="{{ static('js/layui/jquery-3.3.1.min.js') }}"></script>
</head>
<body style="margin-top: 65px;">
<input type="hidden" name="csrfmiddlewaretoken" value="{{ csrf_token }}">
<div class="fly-header layui-bg-black">
    <div class="layui-container">
        <a class="fly-logo" href="/">
            <img src="{{ static('images/logo.png') }}" alt="layui">
        </a>
        <ul class="layui-nav fly-nav layui-hide-xs">
            <li class="layui-nav-item layui-this">
                <a href="/"><i class="iconfont icon-jiaoliu"></i>交流</a>
            </li>
            <li class="layui-nav-item">
                <a href="/case/case"><i class="iconfont icon-iconmingxinganli"></i>案例</a>
            </li>
        </ul>

        <ul class="layui-nav fly-nav-user">
            <!-- 登入后的状态 -->
            <li class="layui-nav-item">
                <a class="fly-nav-avatar" href="javascript:;">
                    <cite class="layui-hide-xs">{{ user.username }}</cite>
                    <i class="iconfont icon-renzheng layui-hide-xs" title="认证信息：layui 作者"></i>
                    <i class="layui-badge fly-badge-vip layui-hide-xs">VIP{{ user.is_vip }}</i>
                    <img src="{{ user.images_url }}">
                </a>
                <dl class="layui-nav-child">
                    <dd><a href="/user/set"><i class="layui-icon">&#xe620;</i>基本设置</a></dd>
                    <dd><a href="/user/index"><i class="iconfont icon-tongzhi" style="top: 4px;"></i>我的消息</a></dd>
                    <dd><a href="/user/home?u={{ user.id }}"><i class="layui-icon"
                                                                style="margin-left: 2px; font-size: 22px;">&#xe68e;</i>我的主页</a>
                    </dd>
                    <hr style="margin: 5px 0;">
                    <dd><a href="/logout" style="text-align: center;">退出</a></dd>
                </dl>
            </li>
        </ul>
    </div>
</div>

<div class="fly-home fly-panel" style="background-image: url();">
    <img src="{{ users.images_url }}" alt="{{ users.username }}">
    <i class="iconfont icon-renzheng" title="Fly社区认证"></i>
    <h1>
        {{ users.username }}
        {% if users.gender == "0" %}
            <i class="iconfont icon-nan"></i>
        {% elif users.gender == "1" %}
            <i class="iconfont icon-nv"></i>
        {% else %}
            <i class="iconfont">保密</i>
        {% endif %}
        <!-- <i class="iconfont icon-nv"></i>  -->
        <i class="layui-badge fly-badge-vip">VIP{{ users.is_vip }}</i>
        <!--
        <span style="color:#c00;">（管理员）</span>
        <span style="color:#5FB878;">（社区之光）</span>
        <span>（该号已被封）</span>
        -->
    </h1>

    <p style="padding: 10px 0; color: #5FB878;">认证信息：layui 作者</p>

    <p class="fly-home-info">
        <i class="iconfont icon-kiss" title="飞吻"></i><span style="color: #FF7200;">{{ users.award }}飞吻</span>
        <i class="iconfont icon-shijian"></i><span>{{ time }}</span>
        <i class="iconfont icon-chengshi"></i><span>{{ users.city }}</span>
    </p>

    {% if users.gender == "0" %}
        {% if users.signature=="" %}
            <p class="fly-home-sign">他很神秘， 什么都没留下....</p>
        {% else %}
            <p class="fly-home-sign">{{ users.signature }}</p>
        {% endif %}
        {#    <p class="fly-home-sign">他很神秘， 什么都没留下....</p>#}
        <span>他的粉丝：{{ fan_m }}</span>&nbsp;&nbsp;&nbsp;
        <span>他的关注：{{ fans_m }}</span>
    {% elif users.gender == "1" %}
        {% if users.signature=="" %}
            <p class="fly-home-sign">她很神秘， 什么都没留下....</p>
        {% else %}
            <p class="fly-home-sign">{{ users.signature }}</p>
        {% endif %}
        <span>她的粉丝：{{ fan_m }}</span>&nbsp;&nbsp;&nbsp;
        <span>她的关注：{{ fans_m }}</span>
    {% elif users.gender == "2" %}
        {% if users.signature=="" %}
            <p class="fly-home-sign">很神秘的用户， 什么都没留下....</p>
        {% else %}
            <p class="fly-home-sign">{{ users.signature }}</p>
        {% endif %}
        <span>他的粉丝：{{ fan_m }}</span>&nbsp;&nbsp;&nbsp;
        <span>他的关注：{{ fans_m }}</span>
    {% endif %}
    <div class="fly-sns" data-user="">
        {% if users.id != user.id %}
            {% if fan_t =="2018" %}
                <a href="javascript:;" class="layui-btn layui-btn-primary fly-imActive" data-type="addFriend"
                   onclick="shoc({{ users.id }})">关注</a>
                <input type="hidden" id="sc" value="do">
            {% elif fan_t == "2020" %}
                <a href="javascript:;" class="layui-btn layui-btn-primary fly-imActive" data-type="addFriend"
                   onclick="shoc({{ users.id }})">取消关注</a>
                <input type="hidden" id="sc" value="undo">
            {% endif %}
        {% endif %}
    </div>

</div>

<div class="layui-container">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md6 fly-home-jie">
            <div class="fly-panel">
                <h3 class="fly-panel-title">{{ user.username }} 最近的提问</h3>
                <ul class="jie-row">
                    {% for sku in news %}
                        <li>

                            <a href="/jie/detail?u={{ sku.id }}" class="jie-title"> {{ sku.title }}</a>
                            <i>{{ sku.create_time.strftime("%Y-%m-%d %H:%M") }}</i>
                            <em class="layui-hide-xs">{{ sku.click_nums }}/阅/{{ sku.comment_num }}答</em>
                        </li>
                    {% endfor %}
                    <!-- <div class="fly-none" style="min-height: 50px; padding:30px 0; height:auto;"><i style="font-size:14px;">没有发表任何求解</i></div> -->
                </ul>
            </div>
        </div>

        <div class="layui-col-md6 fly-home-jie">
            <div class="fly-panel">
                <h3 class="fly-panel-title">{{ user.username }} 最近的案例</h3>
                <ul class="jie-row">
                    {% for sku in case %}
                        <li>

                            <a href="{{ sku.case_url }}" class="jie-title"> {{ sku.title }}</a>
                            <i>{{ sku.create_time.strftime("%Y-%m-%d %H:%M") }}</i>
                            <em class="layui-hide-xs">{{ sku.click_nums }}点赞</em>

                        </li>
                    {% endfor %}

                    <!-- <div class="fly-none" style="min-height: 50px; padding:30px 0; height:auto;"><span>没有回答任何问题</span></div> -->
                </ul>
            </div>
        </div>
    </div>
</div>

<div class="fly-footer">
    <p><a href="#">小宅论坛</a> 2019 &copy; <a href="#">小宅娱乐出品</a>皖ICP备19010957号-1</p>
</div>

<script src={{ static('js/layui/layui.js') }}></script>
<script>
    function shoc(e) {
        var gz = document.getElementById("sc").value;
        var params = {
            "gz": gz,
            "user_id": e
        };
        $.ajax({
            url: "/user/homes",
            type: "post",
            data: JSON.stringify(params),
            contentType: "application/json",
            success: function (resp) {
                if (resp.errno == "0") {
                    location = location
                } else if (resp.errno == "3002") {
                    alert(resp.msg)
                    location.href = "http://www.tnan.top/login"
                } else {
                    alert(resp.msg)
                }
            }
        })
    }

    layui.cache.page = 'user';
    layui.cache.user = {
        username: '游客'
        , uid: -1
        , avatar: '../../res/images/avatar/00.jpg'
        , experience: 83
        , sex: '男'
    };
    layui.config({
        version: "3.0.0"
        , base: '../../static/res/mods/'
    }).extend({
        fly: 'index'
    }).use('fly');
</script>
</body>
</html>